public class Leetcode2341 {

    public int[] numberOfPairs(int[] nums) {
        int[] count = new int[101];
        for (int num : nums) {
            count[num]++;
        }

        int res = 0;
        for (int c : count) {
            res += c / 2;
        }

        return new int[]{res, nums.length - res * 2};
    }
}
